package com.netty.nio;

import java.io.IOException;

public class TimeServer {

    private static int DEFAULT_PORT = 8080;
    public static void main(String[] args) throws IOException {
        int port = 8080;
        if(args != null && args.length > 0 ) {
            try {
                port = Integer.valueOf(args[0]);
            }catch(NumberFormatException e){
                //如果没有传，那我们就使用默认的端口
                port = DEFAULT_PORT;
            }
        }
        //创建一个多路复用器
        MultiplexerTimeServer timeServer = new MultiplexerTimeServer(port);
        //单独启动一个线程
        new Thread(timeServer, "NIO-MultiplexerTimerServer-001").start();
    }

}
